<template>
  <div class="app">
    <h3>App组件，{{ car.name }}: {{car.price}}</h3>
    <Child></Child>
  </div>
</template>

<script>

import Child from "@/components/Child";
import {provide, reactive} from "vue";

export default {
  name: "App",
  components: {Child},
  setup(props, context) {
    let car = reactive({
      name: '奔驰',
      price: '40W'
    });
    provide('car', car); // 给后代组件传递数据
    return {
      car
    }
  }
}
</script>

<style scoped>
.app {
  background-color: gray;
  padding: 10px;
}
</style>